<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" type="text/css" href="__CSS__/main.css" />
    <link rel="stylesheet" type="text/css" href="__CSS__/common.css" />
    <link rel="stylesheet" type="text/css" href="__CSS__/bootstrap.min.css" />
    <script type="text/javascript" src="__EXTEND__/lib/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="__EXTEND__/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="__EXTEND__/lib/layer/2.4/layer.js"></script>
    <![endif]-->
    <title></title>
</head>
<body>
<div class="contant">
<div class="row">
        <div class="top">首页>审批申请</div>
        <div class="content addapply">
          <form action="{:U('Pledge/add_info')}" method="post" id='add_pledge' enctype="multipart/form-data">
            <div class="box larg-box">
                <h1>抵押资料补录<span>(标*为必填项)</span></h1>
                <div class="list-block">
                    <div class="row">
                        <label>登记证书号: <i class="required">*</i></label>
                        <input type="text" name="certificate" value='{$pledge.certificate}'>
                        <label>车牌号: <i class="required">*</i></label>
                        <input type="text" name="plate_number" value='{$pledge.plate_number}'>
                        <label>抵押办理日期: <i class="required">*</i></label>
                        <input type="text" id="add_time" name="pledge_time" value="<empty name='pledge.pledge_time'>{:date('Y-m-d')}<else/>{$pledge.pledge_time|date='Y-m-d', ###}</empty>" class="datepicker" readonly /> 
                        <!-- <input type="date" name="pledge_time" value=''> -->
                    </div>
                     <div class="row">
                        <label>上传照片: <i class="required">*</i></label>
                        <label class="inputfile" for="">
                            <input class="upload" name="img_warranty1" accept="image/*" type="file" style="display: none"/><i>保单1</i>
                            <img class="pic" src="http://{$_SERVER['HTTP_HOST']}/Uploads/{$pledge.img_warranty1}" width='142' height="120" >
                        </label>
                        <label class="inputfile" for="">
                            <input class="upload" name="img_warranty2" accept="image/*" type="file" style="display: none"/><i>保单2</i>
                            <img class="pic" src="http://{$_SERVER['HTTP_HOST']}/Uploads/{$pledge.img_warranty2}" width='142' height="120">
                        </label>
                        <label class="inputfile" for="">
                            <input class="upload" name="img_register1" accept="image/*" type="file" style="display: none"/><i>登记证书1</i>
                            <img class="pic" src="http://{$_SERVER['HTTP_HOST']}/Uploads/{$pledge.img_register1}"  width='142' height="120">
                        </label>
                        <label class="inputfile" for="">
                            <input class="upload" name="img_register2" accept="image/*" type="file" style="display: none"/><i>登记证书2</i>
                            <img class="pic" src="http://{$_SERVER['HTTP_HOST']}/Uploads/{$pledge.img_register2}" width='142' height="120">
                        </label>
                        <label class="inputfile" for="">
                            <input class="upload" name="img_license" accept="image/*" type="file" style="display: none"/><i>驾驶证</i>
                            <img class="pic" src="http://{$_SERVER['HTTP_HOST']}/Uploads/{$pledge.img_license}"  width='142' height="120">
                        </label>
                 
                    </div>
                     <div class="row">
                        <h1>操作</h1>
                        <div class="list-block">
                            <input type="button" class="button01" id='tijiao' value="提交" name="">
                            <input type="button" class="button01" value="暂不提交" name="">
                            <input type='hidden' name='user_id' value='{$Think.get.user_id}'>
                        </div>
                       </div>
                </div>        
        </div>
        </form>
        </div>
    </div>
</div>
    <script src="__PUBLIC__/Admin/js/imgUp.js"></script>
    <script type="text/javascript" src='{:COM}js/daterangepicker.min.js'></script>
    <script src="{:COM}js/ajaxfileupload.js"></script>
    <script src="__PUBLIC__/Admin/js/imgUp.js"></script>    
    <script type="text/javascript">
        <volist name="info.file" id="file">
            $('#file{$file}').attr('checked', true);
             $('#file{$file}').attr('disabled', true);
        </volist>
    </script>
    
    <script type="text/javascript">
    $('input.datepicker').datetimepicker({format : "yyyy-mm-dd", minView : 2, autoclose : true});
    $('#tijiao').click(function(){
         var img1=$("input[name='img_file1']").val(),img2=$("input[name='img_file2']").val(),img3=$("input[name='img_file3']").val(),img4=$("input[name='img_file4']").val(),img5=$("input[name='img_file5']").val();
            if ($("input[name='certificate']").val()=='') {
               return false;
            }else if ($("input[name='plate_number']").val()=='') {
               return false;
            }else if (img1==''||img2==''||img3==''||img4==''||img5=='') {
              alert('请将信息补充完整后提交');
              return false;
            }
      $('#add_pledge').submit();
    })
   $(function() {
        $("i").click(function (elm) {

        $(this).siblings('.upload').click();//隐藏了input:file样式后，点击头像就可以本地上传
        $(this).siblings('.upload').on("change",function(){
            var objUrl = getObjectURL(this.files[0]) ; //获取图片的路径，该路径不是图片在本地的路径
            if (objUrl) {
            $(this).siblings('.pic').attr("src", objUrl) ; //将图片路径存入src中，显示出图片
            }
            });
        });
    });
     
    //建立一個可存取到該file的url
    function getObjectURL(file) {
        var url = null ;
        if (window.createObjectURL!=undefined) { // basic
        url = window.createObjectURL(file) ;
        } else if (window.URL!=undefined) { // mozilla(firefox)
        url = window.URL.createObjectURL(file) ;
        } else if (window.webkitURL!=undefined) { // webkit or chrome
        url = window.webkitURL.createObjectURL(file) ;
        }
        return url ;
    }
    </script>
</body>
</html>